/// @tags: Matrix DP
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

namespace BlueQuantum {

typedef long long ll;

int const N = 1e5 + 5, mod = 1e9 + 7;

struct Matrix {
  ll a[26][26];

  Matrix() { memset(a, 0, sizeof(a)); }

  inline Matrix operator*(Matrix const &rhs) const {
    Matrix res;
    for (int k = 0; k < 26; k++)
      for (int i = 0; i < 26; ++i)
        for (int j = 0; j < 26; ++j)
          res.a[i][j] = (res.a[i][j] + a[i][k] * rhs.a[k][j] % mod) % mod;
    return res;
  }

  inline Matrix operator^(ll exp) {
    Matrix res;
    for (int i = 0; i < 26; ++i) res.a[i][i] = 1;
    while (exp) {
      if (exp & 1) res = res * *this;
      *this = *this * *this;
      exp >>= 1;
    }
    return res;
  }
} A;

ll n;
char str[N];

inline int main() {
  cin >> n >> str;
  for (int i = 0; i < 26; ++i)
    for (int j = 0; j < 26; ++j) A.a[i][j] = 1;
  int m = strlen(str);
  for (int i = 0; i < m - 1; ++i) A.a[str[i] - 'a'][str[i + 1] - 'a'] = 0;
  A = A ^ (n - 1);
  ll ans = 0;
  for (int i = 0; i < 26; ++i)
    for (int j = 0; j < 26; ++j) ans = (ans + A.a[i][j]) % mod;
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P5337 [TJOI2019]甲苯先生的字符串.in", "r", stdin);
  freopen("P5337 [TJOI2019]甲苯先生的字符串.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}